// hyb_yl/zhuanjiasubpages/pages/orderedtime/orderedtime.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    inquiry:"",
    mtext:"",
    dataweek:[],
    dex:0,
    times: ["19:00-20:00", "20:00-21:00", "20:00-21:00", "20:00-21:00"]
  },
  // 选择时间
  getdate(e){
    this.setData({
      dex:e.currentTarget.dataset.i
    })
  },
  seltime(e){
    let times = e.currentTarget.dataset.time;
    let dates = this.data.dataweek[this.data.dex];
    let str = this.data.mtext + "," + dates.time + "," + dates.weeks + "," + times
    wx.navigateTo({
      url: '/hyb_yl/czhuanjiasubpages/pages/information/information?inquiry=' + this.data.inquiry + '&times=' + str,
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    let datas = new Date();
    let m = datas.getMonth();
    let mtext = m + 1 == 1 ? "一" : m + 1 == 2 ? "二" : m + 1 == 3 ? "三" : m + 1 == 4 ? "四" : m + 1 == 5 ? "五" : m + 1 == 6 ? "六" : m + 1 == 7 ? "七" : m + 1 == 8 ? "八" : m + 1 == 9 ? "九" : m + 1 == 10 ? "十" : m + 1 == 11 ? "十一" : m + 1 == 12 ? "十二" :"";
    let times = []
    for(let i=0;i<7;i++){
      let wek = datas.getDay() + i == 0 ? '日' : datas.getDay() + i == 1 ? '一' : datas.getDay() + i == 2 ? '二' : datas.getDay() + i == 3 ? '三' : datas.getDay() + i == 4 ? '四' : datas.getDay() + i == 5 ? '五' :'六'
      let obj = {
        time: datas.getDate() + i,
        weeks: wek
      }
      times.push(obj)
    }
    this.setData({
      mtext,
      dataweek: times,
      inquiry: options.inquiry
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})